package gameobjects;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;

import com.golden.gamedev.Game;
import com.golden.gamedev.object.sprite.AdvanceSprite;


public class Kitty extends AdvanceSprite {
    private Game myGame;
    private BufferedImage[] myImages;
    
    public Kitty(Game game)
    {
        super();
        myGame = game;
        createKitty();
    }
    
    private void createKitty()
    {
        myImages = new BufferedImage[40];
        for(int i = 0; i < 40;i++)
        {
            String temp = "Resources/cat" + (i+1) + ".gif";
            myImages[i] = myGame.getImage(temp);
        }
        this.setImages(myImages);
        this.setLoopAnim(false);
        this.setVerticalSpeed(.01);
        this.setLocation(400, 500);
    }
    
    public void animate()
    {
        
    }
    
    public void checkKeyboardInputandUpdate(long elapsedTime)
    {
        if(myGame.keyDown(KeyEvent.VK_RIGHT))
        {
            this.setAnimationFrame(0, 19);
            this.moveX(3);
            this.setAnimate(true);
        }
        if(myGame.bsInput.isKeyReleased(KeyEvent.VK_RIGHT))
        {
            this.setActive(false);
        }
        if(myGame.keyDown(KeyEvent.VK_LEFT))
        {
            this.setAnimationFrame(20, 39);
            this.moveX(-3);
            this.setAnimate(true);
        }
        if(myGame.keyPressed((KeyEvent.VK_UP)))
        {
            this.moveY(-20);

        }
        this.update(elapsedTime);
    }
}
